package com.aoxin.service.impl.opm;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aoxin.mapper.opm.SlfClassroomSyllabusDateMapper;
import com.aoxin.model.opm.SlfClassroomSyllabusDate;
import com.aoxin.service.inter.opm.ClassroomSyllabusDateService;

@Service("classroomSyllabusDateService")
public class ClassroomSyllabusDateServiceImpl implements ClassroomSyllabusDateService {

    @Autowired
    private SlfClassroomSyllabusDateMapper slfClassroomSyllabusDateMapper;

    @Override
    public Integer deleteClassroomSyllabusDate(List<Integer> classroomSyllabusDateIds) {
        Integer result = 0;
        if(classroomSyllabusDateIds != null && classroomSyllabusDateIds.size()>0){
            result = slfClassroomSyllabusDateMapper.deleteClassroomSyllabusDate(classroomSyllabusDateIds);
        }
        return result;
    }

    @Override
    public Integer insertClassroomSyllabusDate(Integer classroomId,List<Integer> syllabusDateIds) {
        Integer result = 0;
        if(classroomId != null && syllabusDateIds != null && syllabusDateIds.size() > 0){
            slfClassroomSyllabusDateMapper.deleteByClassroomIdAndSyllabusDateId(classroomId,syllabusDateIds);
            for(Integer i:syllabusDateIds){
                result = slfClassroomSyllabusDateMapper.insertClassroomSyllabusDate(classroomId,i);
            }
        }
        return result;
    }

    @Override
    public List<SlfClassroomSyllabusDate> getSlfClassroomSyllabusDate(SlfClassroomSyllabusDate slfClassroomSyllabusDate) {
        List<SlfClassroomSyllabusDate> slfClassroomSyllabusDateList= slfClassroomSyllabusDateMapper.getSlfClassroomSyllabusDate(slfClassroomSyllabusDate);
        return slfClassroomSyllabusDateList;
    }
}
